<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Event对象属性ie8及以下</title>
</head>

<body>
    <input type="button" value="点击我" id="btn">
    <a id="a" href="http://www.baidu.com">跳转</a>
    <div id="parent">
        <div class="child">点击我</div>
    </div>
    <script>
        var div = document.getElementById("btn");
        div.addEventListener("onclick", function (event) {
            alert(event.type);
        });
        var a = document.getElementById("a");
        a.addEventListener("onclick", function (event) {
            event.returnValue = false;//阻止默认行为 同preventDefault
        });

        //event.cancelBubble = true 取消事件冒泡 同stopPropagetion
        var parent = document.getElementById("parent");
        parent.addEventListener("onclick", function (event) {
            alert("parent被触发");
        });
        var child = document.getElementById("child");
        parent.addEventListener("onclick", function (event) {
            event.cancelBubble = true;
            alert("child");
        });
        //srcElement 同target
    </script>
</body>

</html>